<?php
/* 
 * Copyright (c) 2018-2021   All rights reserved.
 * 
 * 创建时间：2021-11-18 16:04
 *
 * 项目：rm  -  $  - input_vote.php
 *
 * 作者：liwei 
 */


use modules\levfm\widgets\inputs\inputsFormWidget;

?>

<?php foreach ($inputs as $v) : $v['inputname'] = $v['inputname'] ?: \modules\levfm\table\LevfmForms::tableFieldname($v['id']);?>
    <?php if ($options = inputsFormWidget::getSelectItem($v)):$_totalitem = [];?>
        <?php $idx = -1; $styles[] = '.formFieldBox.field-settingsmodel-'.$v['inputname'];?>
        <div class="vote-mainv flex-box ju-sa">
            <?php echo \modules\levfm\table\LevfmFields::setBtn($v['id'])?>
            <div class="vote-container-main"><div class="vote-container" id="vote-container-<?=$v['inputname']?>"></div></div>
            <div class="vote-btns-box flex-box ju-sa count-x<?=($_cot = count($options)) == 12 ? 12 : ($_cot >12?20:$_cot)?>">
                <?php foreach ($options as $_id => $_name): $idx++; ?>
                    <?php $_totalitem[] = $_tt = Lev::arrv($_id, $totalitem[$v['inputname']], 0)+$tempNum;?>
                    <div class="vote-btn-box doVoteBtn doSubmitv" idx="<?=$idx?>" inputname="<?=$v['inputname']?>" val="<?=$_id?>">
                    <span class="cir_b zoospan color-out-<?=$sx=$_id%5?> sx-<?=$sx?>">
                        <span class="cir_s color-<?=$sx?>"><?=$_name?></span>
                    </span>
                        <div class="flex-box color-red ju-sa">
                            <div style="margin:5px auto"><tpnum class="ds-0"><?=$_tt?></tpnum><small>票</small></div>
                        </div>
                    </div>
                <?php endforeach;?>
            </div>

            <script>jQuery(function () { levfmJs.setFmHighcharts('<?=$v['inputname']?>', '<?=$v['title']?>', <?=json_encode(array_values($options))?>, <?=json_encode($_totalitem)?>); });</script>

        </div>
    <?php endif;?>

<?php endforeach;?>

<input type="hidden" name="votenums">

<?=isset($styles) ? '<style>'.implode(',', $styles).'{display:none !important}</style>':''?>



